Refresh part of visualforce using reRender
Apex Class
public with sharing class ActionDemoController {
public String name {get; set;}
public void show(){
name = 'inside the show method';
}
}
Visualforce
<apex:page controller="ActionDemoController" id="page">
<!-- to refresh part of the page, use the reRender attribute along with action component -->
<apex:form id="fm" title="main block">
<apex:pageBlock id="pb1">
<apex:commandButton value="call show" action="{!show}" reRender="pb2"/>
</apex:pageBlock>
<apex:pageblock title="result" id="pb2">
{!name}
</apex:pageblock>
</apex:form>
</apex:page>